<?php
global $post, $more;
$defaults = array(
    'quality'   => 100,
    'embed'     => ''
);
$opts = get_post_meta( $post->ID, 'dt_post_thumb_opts_options', true );
$opts = wp_parse_args( $opts, $defaults );

$pass_prot = post_password_required();
?>

<div <?php post_class( 'article blog' ); ?>>
    <h1><a href="<?php the_permalink(); ?>"><?php
		$title = get_the_title();
		echo dt_first_letter_filter( $title );
		?></a></h1>
	<?php if( has_post_thumbnail() && empty($opts['embed']) && !$pass_prot ): // post featuredimage ?>
    
		<?php
		$thumb = dt_get_thumbnail(
            array(
                'post_id'	=> $post->ID,
                'width'		=> 450,
                'upscale'	=> false,
                'quality'   => $opts['quality']
            )        
        );
		?>
        
		<a href="<?php the_permalink(); ?>" class="blog_ico">
            <img src="<?php echo $thumb['thumnail_img']; ?>" alt="" <?php echo $thumb['size_str']; ?>/>
			<i></i>
		</a>
    <?php elseif( $opts['embed'] && !$pass_prot ): ?>
    
        <?php
        $opts['embed'] = sprintf(
            '[embed width=%d]%s[/embed]',
            450,
            $opts['embed']
        );
        ?>
        <div class="blog_ico">
            <?php
            $opts['embed'] = apply_filters( 'the_content', $opts['embed']);
            echo str_replace( array('<p>', '</p>'), '', $opts['embed'] );
            ?>
        </div>
        
	<?php endif; ?>
    
    <div class="blog_meta">

		<a href="<?php the_permalink() ?>" class="add_date">
			<?php the_time(get_option('date_format')); ?>
		</a>
					  
		<a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>" class="blog_author">
			<?php echo get_the_author(); ?>
		</a>
		
		<?php if( comments_open() ): // comments ?>
			<a href="<?php the_permalink(); ?>#comments" class="comments_count">
			<?php
			comments_number(
				__( 'no comments', LANGUAGE_ZONE ),
				__( '1 comment', LANGUAGE_ZONE ),
				__( '% comments', LANGUAGE_ZONE )
			);
			?>
			</a>
			
		<?php endif; ?>

		<?php // category
		$categories = get_the_category_list( __( ', ', LANGUAGE_ZONE ) );
		if( $categories ):
		?>					
			<span class="blog_category">
				<?php echo $categories; ?>
			</span>
		<?php endif ?>
					
		<?php //tags
		$tags = get_the_tag_list( '', __( ', ', LANGUAGE_ZONE ) );
		if( $tags ):			
		?>              
			<span class="blog_tags">
				<?php echo $tags; ?>
			</span>
		<?php endif; ?>
		
    </div>
    <div class="blog_desk">
		<?php
        $more = 0;
		if( is_search() || is_archive() || !dt_content_question($post->post_content) ){
			the_excerpt();
            
        ?>    
            <div class="pages">
                <a href="<?php the_permalink($post->ID); ?>" class="more-link"><span><?php _e('Details', LANGUAGE_ZONE); ?><i></i></span></a>
            </div>
		<?php
        }else {
			the_content( '<span>'.__('Details', LANGUAGE_ZONE).'<i></i></span>' );
		}
        
        wp_link_pages(
            array(
                'before'        => '<div class="paginator inblog details pages"><div class="pages">',
                'after'         => '</div></div>',
                'pagelink'      => '<span>%</span>'
            )
        );
		?>
        
        <?php dt_edit_link(); ?>
    
    </div>
	
</div>